package node;

import lexer.LexType;
import parser.Parser;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class FuncFParamsNode extends ASTNode {
    public final String name = "<FuncFParams>";
    // FuncFParams → FuncFParam { ',' FuncFParam }
    private List<FuncFParamNode> funcFParamNodes = new ArrayList<>();

    public FuncFParamsNode(List<FuncFParamNode> funcFParamNodes) {
        this.funcFParamNodes = funcFParamNodes;
    }

    @Override
    public void show() throws IOException {
        for (int i = 0; i < funcFParamNodes.size(); i++) {
            funcFParamNodes.get(i).show();
            if (i != funcFParamNodes.size() - 1) {
                Parser.parserWriter.write(LexType.COMMA + " " + "," + "\n");
            }
        }
        Parser.parserWriter.write(name + "\n");
    }

    public List<FuncFParamNode> getFuncFParamNodes() {
        return funcFParamNodes;
    }

}
